<template>
  <div>
    <a-row :gutter="10">
      <a-card :bordered="false">
        <!-- 查询区域 11111-->
        <div class="table-page-search-wrapper">
          <a-form layout="inline" :label-col="labelCol" @keyup.enter.native="searchQuery">
            <a-row :gutter="24">
              <a-col :md="6" :sm="6">
                <a-form-item label="咨询人姓名">
                  <a-input placeholder="请输入咨询人姓名" v-model="queryParam.name"></a-input>
                </a-form-item>
              </a-col>
              <a-col :md="6" :sm="6">
                <a-form-item label="回复负责人">
                  <a-input placeholder="请输入回复负责人" v-model="queryParam.receiver"></a-input>
                </a-form-item>
              </a-col>
              <a-col :md="6" :sm="6">
                <a-form-item label="回复状态">
                  <a-select v-model="queryParam.followStatus" placeholder="请选择回复状态">
                    <a-select-option value="">请选择</a-select-option>
                    <a-select-option value="0">未回复</a-select-option>
                    <a-select-option value="1">已回复</a-select-option>
                  </a-select>
                </a-form-item>
              </a-col>
              <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
           <a-col :md="6" :sm="24">
               <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
               <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
           </a-col>
        </span>
            </a-row>
          </a-form>
        </div>


        <!-- table区域-begin -->
        <div>
          <a-table
            ref="table"
            size="middle"
            bordered
            rowKey="id"
            :scroll="{x:1300}"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            @change="handleTableChange">

           <span slot="action" slot-scope="text, record">
                <a @click="handleEdit(record)" v-if="record.followStatus=='0'">回复</a>
              </span>

            <template slot="followStatus" slot-scope="text,record">
              <a-tag color="pink" v-if="text=='0'">未回复</a-tag>
              <a-tag color="green" v-if="text=='1'">已回复</a-tag>
            </template>

          </a-table>
        </div>

        <a-modal :maskClosable="false"
                 v-model="visible"
                 :title="title"
                 :width="600"
                 :ok-button-props="{ props: { disabled: false } }"
                 :cancel-button-props="{ props: { disabled: false } }"
                 @ok="handleOk"
        >
          <label>{{ model.remark }}</label>
          <a-textarea placeholder="请输入回复内容" v-model="model.reply" :rows="4" style="margin-top: 16px" />
        </a-modal>
      </a-card>
    </a-row>
  </div>

</template>
<script>
import '@assets/less/TableExpand.less'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { putAction, getAction, postAction, deleteAction, httpAction } from '@api/manage'
import { frozenBatch, queryMyNurseCategoryTreeList, searchByKeywords } from '@api/api'

export default {
  name: 'h_his_nurse_service_projectList',
  mixins: [JeecgListMixin],
  components: {},
  data() {
    return {
      description: '配套服务',
      labelCol: { style: { width: '110px' } },
      visible: false,
      queryParam: {},
      // 表头
      columns: [
        {
          title: '咨询人时间',
          align: 'center',
          dataIndex: 'createUser',
          width: 130
        },
        {
          title: '咨询人姓名',
          align: 'center',
          dataIndex: 'name',
          width: 130
        },
        {
          title: '咨询人手机',
          align: 'center',
          dataIndex: 'phone',
          width: 130
        },
        {
          title: '咨询内容',
          align: 'center',
          dataIndex: 'remark'
        },
        {
          title: '回复状态',
          align: 'center',
          dataIndex: 'followStatus',
          scopedSlots: { customRender: 'followStatus' },
          width: 120
        },
        {
          title: '回复内容',
          align: 'center',
          dataIndex: 'followResult'
        },
        {
          title: '回复负责人',
          align: 'center',
          dataIndex: 'receiver',
          width: 130
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
          width: 100
        }
      ],
      url: {
        list: '/his/marketing/consult/list',
        reply: '/his/marketing/consult/reply'
      },
      loading: false,
      disable: true,
      model:{
        remark:"",
        reply: '',
        id: 0,
      },
      title: ''
    }
  },
  computed: {},
  created() {

  },
  methods: {
    handleEdit(record) {
      this.model.id = record.id
      this.model.remark = record.remark
      this.title = '回复 ' + record.name
      this.visible = true
    },
    handleOk(e) {
      console.log(e)
      const that = this
      postAction(this.url.reply, this.model).then((res) => {
        if (res.success) {
          that.$message.success(res.message)
          that.loadData();
        } else {
          that.$message.warning(res.message)
        }
      }).finally(() => {
        that.confirmLoading = false
        that.handleCancel();
      })
    },
    handleCancel(e) {
      this.model = Object.assign({}, { });
      this.visible = false

    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>